﻿<CodeSnippetTabbed DocLink="https://docs.devexpress.com/Blazor/402066/common-concepts/validate-input">
    <CodeSnippetTabPage Text="Razor">@(@"<EditForm Model=""@starship"" OnValidSubmit=""@HandleValidSubmit"" OnInvalidSubmit=""@HandleInvalidSubmit"" Context=""EditFormContext"">
    <DataAnnotationsValidator />
    <DxFormLayout >
        <DxFormLayoutItem Caption=""Identifier:"" ColSpanMd=""6"" >
            <Template >
                <DxTextBox @bind-Text=""@starship.Identifier"" />
            </Template >
        </DxFormLayoutItem >
        <DxFormLayoutItem Caption=""Primary Classification:"" ColSpanMd=""6"" >
            <Template >
                <DxComboBox
                            NullText=""Select classification ...""
                            ClearButtonDisplayMode=""DataEditorClearButtonDisplayMode.Auto""
                            @bind-Value=""@starship.Classification""
                            Data=""@(new List<string>() { ""Defense"", ""Exploration"", ""Diplomacy"" })""
                />
            </Template >
        </DxFormLayoutItem >
        <DxFormLayoutItem Caption=""Maximum Accommodation:"" ColSpanMd=""6"" >
            <Template >
                <DxSpinEdit Id=""accommodation"" @bind-Value=""@starship.MaximumAccommodation"" />
            </Template >
        </DxFormLayoutItem >
        <DxFormLayoutItem Caption=""Production Date:"" ColSpanMd=""6"" >
            <Template >
                <DxDateEdit @bind-Date=""@starship.ProductionDate"" />
            </Template>
        </DxFormLayoutItem>
        <DxFormLayoutItem ColSpanMd=""12"">
            <Template>
                <ValidationSummary />
            </Template>
        </DxFormLayoutItem>
        <DxFormLayoutItem ColSpanMd=""12"">
            <Template>
                <DxButton SubmitFormOnClick=""true"" Text=""Submit"" RenderStyle=""ButtonRenderStyle.Secondary"" />
            </Template>
        </DxFormLayoutItem>
    </DxFormLayout>
</EditForm>

@code {
    private Starship starship=new Starship();

    private void HandleValidSubmit()
    {
        Console.WriteLine(""OnValidSubmit"");
    }
    private void HandleInvalidSubmit()
    {
        Console.WriteLine(""OnInvalidSubmit"");
    }
}")</CodeSnippetTabPage>
</CodeSnippetTabbed>
